<!--
 * @Description: 24小时日志
 * @Author: 0001100986/LiuShuai
 * @Date: 2021-06-10 14:30:11
 * @LastEditTime: 2021-08-04 15:01:37
 * @LastEditors: 0001100986/LiuShuai
-->
<template>
  <div class="hours-box">
    <el-button @click="cancel">返回</el-button>
    <el-button @click="download" style="float:right">下载</el-button>
    <tao-table class="table-box" height="560px" :data="dataList" ref="table">
      <el-table-column label="StartTime" align="center" width="170" sortable prop="start" />
      <el-table-column label="EndTime" align="center" width="170" sortable prop="end" />
      <el-table-column label="VtyNo" align="center" width="100" prop="vtyno" show-overflow-tooltip />
      <el-table-column
        label="UserName"
        align="center"
        width="110"
        prop="username"
        show-overflow-tooltip
      />
      <el-table-column
        label="HostName"
        align="center"
        width="120"
        prop="hostname"
        show-overflow-tooltip
      />
      <el-table-column label="Result" align="center" width="120" prop="result" />
      <el-table-column label="CMDLine" min-width="200" prop="cmd" show-overflow-tooltip />
    </tao-table>
  </div>
</template>

<script>
import { downloadMater } from '@/utils/download';
export default {
  props: ['dataList'],
  methods: {
    // 返回
    cancel () {
      let _this = this;
      _this.$emit('handleChange', 0);
    },
    download () {
      let _this = this;
      let arry = [];
      _this.dataList.forEach(ele => {
        arry.push({
          'StartTime': ele.start,
          'EndTime': ele.end,
          'VtyNo': ele.vtyno,
          'UserName': ele.username,
          'IP': ele.hostname,
          'HostName': ele.title,
          'Result': ele.result,
          'CMDLine': ele.cmd,
        });
      });
      downloadMater(arry);
    }
  }
};
</script>

<style lang='scss' scoped>
.hours-box {
  ::v-deep .el-button {
    margin-bottom: 15px;
  }
}
</style>